<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
    <div class="container-div">
    <div class="row">
    	<div class="col-sm-12 search-collapse">
			<form id="idleTotal-form">
				<div class="select-list">
					<ul>
						<li>
							姓名：<input type="text" name="empNm" th:value="${baseInfo.empNm}" />
						</li>
						<li>
							证件号码：<input type="text" name="empId" th:value="${baseInfo.empId}" />
						</li>
						<li>
							公司名称：<input type="text" name="compNm" th:value="${baseInfo.empComp}" />
						</li>
						<li>
							<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
						</li>
					</ul>
				</div>
			</form>
		</div>
		<div class="btn-group-sm hidden-xs" id="toolbar" role="group">
			<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="pm:idleResult:edit">
	            <i class="fa fa-edit"></i> 填写缺勤说明
	        </a>
		</div>
			
		<div class="col-sm-12 select-table table-striped">
			<table id="bootstrap-table" data-mobile-responsive="true"></table>
		</div>
    </div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var prefix = ctx + "pm/idleResult";

        $(function() {
            var options = {
                url: prefix + "/list",
                updateUrl: prefix + "/edit/{id}",
                queryParams: queryParams,
                modalName: "人员缺勤明细",
                search:false,
                showSearch:false,
                showColumns:false,
                showToggle:false,
                showExport:false,
                showRefresh:false,
                columns: [{
		            checkbox: true
		        },
				{
					field : 'idleId', 
					title : '主键',
					visible: false
				},
				{
					field : 'empId', 
					title : '证件号码' 
				},
				{
					field : 'empNm', 
					title : '姓名' 
				},
				{
					field : 'compNm', 
					title : '供应商名称' 
				},
				{
					field : 'idleDate', 
					title : '缺勤日期',
		            formatter: function(value, row, index) {
		            	var html ="";
		            	if(!!row.idleDate)
		            		html = '<span>'+row.idleDate.substr(0,10)+'</span>';
		            	return html;
		            } 
				},
				{
					field : 'idleNote', 
					title : '缺勤说明' 
				}]
            };
            $.table.init(options);
        });
        
        function queryParams(params) {
			return {
				empId:          $("input[name='empId']").val(),
				pageSize:       params.limit,
    			pageNum:        params.offset/params.limit + 1,
    			searchValue:    params.search,
    			orderByColumn:  params.sort,
    			isAsc:          params.order
			};
		}
    </script>
</body>
</html>